package com.hqyj.zss.controller;

import com.hqyj.zss.pojo.Menus;
import com.hqyj.zss.service.GetFoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/food")
public class FoodController {

    private GetFoodService getFoodService;

    @Autowired
    public void setGetFoodService(GetFoodService getFoodService) {
        this.getFoodService = getFoodService;
    }

    @RequestMapping("/staple_food")
    public List<Menus> staple_food(){
        String name = "主食";
        List<Menus> list = new ArrayList<>();
        list = getFoodService.getStapleFood(name);
        for (Menus menus:list){
            System.out.println(menus.toString());
        }
        return list;
    }

    @RequestMapping("/street_food")
    public List<Menus> street_food(){
        String name = "小吃";
        List<Menus> list = new ArrayList<>();
        list = getFoodService.getStreetFood(name);
        for (Menus menus:list){
            System.out.println(menus.toString());
        }
        return list;
    }
    @RequestMapping("/drink")
    public List<Menus> drink(){
        String name = "饮品";
        List<Menus> list = new ArrayList<>();
        list = getFoodService.getDrink(name);
        for (Menus menus:list){
            System.out.println(menus.toString());
        }
        return list;
    }
}
